var isSymmetric = function(root) {
    if(root==null) return true
    return duicheng(root.left,root.right)
};

function duicheng(left,right){
    if(left.left==null&&right.right==null&&left.right==null&&right.left==null)return true
    if(left.left==null&&right.right==null&&left.right.val===right.left.val){
        return duicheng(left.right,right,left)
    }else if(left.right==null&&right.left==null&&left.left.val==right.right.val){
        return duicheng(left.left,right.right)
    } else if(left.right.val===right.left.val&&left.left.val==right.right.val){
        return duicheng(left.right,right.left)&&duicheng(left.left,right.right)
    }else{
        return false
    }
}